#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution {
public:
    void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
        int i = 0;
        int j = 0;
        while(i<m&&j<n){
            if(nums2[j]<nums1[i]){
                for(int index=nums1.size()-1;index>i;--index){
                    nums1[index] =  nums1[index-1];
                }
                nums1[i] = nums2[j];
                ++i;
                ++j;     
                ++m;    
            }
            else{
                ++i;
            }
        }
        while(j<n){
            nums1[i++] = nums2[j++];
            
        }
    }
};

int main(){
    Solution S;
    vector<int> nums1 = {4,0,0,0,0,0};
    vector<int> nums2 = {1,2,3,5,6};
    S.merge(nums1,1,nums2,5);

    return 0;
}